package com.teamide.exception;

import com.teamide.util.StringUtil;

public class BaseException extends Exception {

	/**
	 * 
	 */
	private static final long serialVersionUID = 5851650165956394577L;

	private final String errcode;

	private final String errmsg;

	public BaseException(String errmsg) {
		this(null, errmsg);
	}

	public BaseException(Throwable cause) {
		this(null, cause.getMessage(), cause);
	}

	public BaseException(String errmsg, Throwable cause) {
		this(null, errmsg, cause);
	}

	public BaseException(String errcode, String errmsg) {
		super(errmsg);
		if (StringUtil.isEmpty(errcode)) {
			errcode = "1";
		}
		this.errcode = errcode;
		this.errmsg = errmsg;
	}

	public BaseException(String errcode, String errmsg, Throwable cause) {
		super(errmsg, cause);
		this.errcode = errcode;
		this.errmsg = errmsg;
	}

	public String getErrcode() {
		return errcode;
	}

	public String getErrmsg() {
		return errmsg;
	}

}
